{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "import math\n",
    "\n",
    "class Point:\n",
    "    def __init__(self, x, y):\n",
    "        self.x = x\n",
    "        self.y = y\n",
    "        \n",
    "    def __str__(self):\n",
    "        return f\"Point({self.x}, {self.y})\"\n",
    "    \n",
    "    def getDistance(self, other):\n",
    "        w = self.x - other.x\n",
    "        h = self.y - other.y\n",
    "        \n",
    "        return math.sqrt(w**2 + h**2)\n",
    "    \n",
    "class Circle(Point):\n",
    "    def __init__(self, x, y, r):\n",
    "        super().__init__(x, y)\n",
    "        self.r = r\n",
    "        \n",
    "    def __str__(self):\n",
    "        return f\"Circle(o = {super().__str__()}, r = {self.r})\"\n",
    "        \n",
    "    def getArea(self):\n",
    "        return self.r**2 + math.pi\n",
    "    \n",
    "    def getPerimeter(self):\n",
    "        return self.r * 2 * math.pi"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Circle(o = Point(2, 3), r = 4)\n",
      "19.141592653589793\n",
      "25.132741228718345\n",
      "Circle(o = Point(5, 6), r = 7)\n",
      "52.1415926535898\n",
      "43.982297150257104\n",
      "====\n",
      "4.242640687119285\n"
     ]
    }
   ],
   "source": [
    "c1 = Circle(2, 3, 4)\n",
    "print(c1)\n",
    "print(c1.getArea())\n",
    "print(c1.getPerimeter())\n",
    "\n",
    "c2 = Circle(5, 6, 7)\n",
    "print(c2)\n",
    "print(c2.getArea())\n",
    "print(c2.getPerimeter())\n",
    "print(\"====\")\n",
    "print(c1.getDistance(c2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Point(2, 3)\n",
      "Point(5, 7)\n",
      "5.0\n"
     ]
    }
   ],
   "source": [
    "p1 = Point(2, 3)\n",
    "p2 = Point(5, 7)\n",
    "print(p1)\n",
    "print(p2)\n",
    "print(p1.getDistance(p2))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.9.2 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.2"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "25034407fed5d681614dac11a1c0537e8cb49e3a8883c071303eea01322943d9"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
